<?php

$chart = $_GET['chart'];
$trader = $_GET['trader'];
$traderNo = $_GET['traderNo'];
$specialist = $_GET['specialist'];
$level1 = $_GET['level1'];
$level2 = $_GET['level2'];
$game = $_GET['game'];
$items = $_GET['items'];
$start = $_GET['start'];
$status = $_GET['status'];

if(!$chart)$chart = 'traderShout';
if(!$trader)$trader = 'buyer_gd';
if(!$traderNo)$traderNo = '';
if(!$specialist)$specialist = '';
if(!$level1)$level1 = 'sp';
if(!$level2)$level2 = 'si';
if(!$game)$game='0001';
if(!$items)$items=20;
if(!$start)$start=0;
if(!$status)$status='both';

$$chart = "SELECTED";
$$trader = "SELECTED";
$$level1 = "SELECTED";
$$level2 = "SELECTED";
$$status = "SELECTED";

$Params = $chart.','.$trader.','.$traderNo.','.$specialist.','.$level1.','.$level2.','.$game.','.$items.','.$start.','.$status;

echo '
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>TAC Market Design</title>
<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">';

switch ($chart) {
	case 'traderShout' :
	if($status=='placed'){
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"traderShoutPlaced.php?Params='.$Params.'"} );';
	}elseif($status=='pending'){
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"traderShoutPending.php?Params='.$Params.'"} );';
	}else{
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"traderShout.php?Params='.$Params.'"} );';
	}
	break;
	
	case 'traderMigration' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"traderMigration.php?Params='.$Params.'"} );';
	break;
	
	case 'specialistQuantity' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistQuantity.php?Params='.$Params.'"} );';
	break;
	
	case 'specialistPrice' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistPrice.php?Params='.$Params.'"} );';
	break;
	
	case 'specialistCoefficient' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistCoefficient.php?Params='.$Params.'"} );';
	break;	
	
	case 'specialistCharge' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistCharge.php?Params='.$Params.'"} );';
	break;

	case 'specialistNumTrader' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistNumTrader.php?Params='.$Params.'"} );';
	break;

	case 'specialistQAP' :
		echo 'swfobject.embedSWF("open-flash-chart.swf", "jcat_chart", "780", "420", "9.0.0", "jcat-chart.swf", {"data-file":"specialistQAP.php?Params='.$Params.'"} );';
	break;
}




echo '
</script>
 
</head>
<body> 
<table><tr><td>
<div id="jcat_chart"></div>
</td><td valign="top">
<FORM action="./index.php" method="get">
    <P>
    <LABEL for="chart">圖表: </LABEL>
		<select name="chart">
			<option value="traderShout" '.$traderShout.'>交易商喊價特徵</option>
			<option value="traderMigration" '.$traderMigration.'>交易商移動特徵</option>
			<option value="specialistQuantity" '.$specialistQuantity.'>市場交易數量</option>
			<option value="specialistPrice" '.$specialistPrice.'>市場交易價格</option>
			<option value="specialistCoefficient" '.$specialistCoefficient.'>市場交易係數</option>
			<option value="specialistCharge" '.$specialistCharge.'>市場專家收費</option>
			<option value="specialistNumTrader" '.$specialistNumTrader.'>市場內之交易商類型分佈</option>		
			<option value="specialistQAP" '.$specialistQAP.'>市場內之交易商喊價接受</option>
		</SELECT><BR />
	<LABEL for="trader">交易商類型: </LABEL>
		<select name="trader">
			<option value="buyer_zic" '.$buyer_zic.'>買方-ZIC</option>
			<option value="buyer_gd" '.$buyer_gd.'>買方-GD</option>
			<option value="buyer_re" '.$buyer_re.'>買方-RE</option>
			<option value="buyer_zip" '.$buyer_zip.'>買方-ZIP</option>
			<option value="seller_zic" '.$seller_zic.'>賣方-ZIC</option>
			<option value="seller_gd" '.$seller_gd.'>賣方-GD</option>
			<option value="seller_re" '.$seller_re.'>賣方-RE</option>
			<option value="seller_zip" '.$seller_zip.'>賣方-ZIP</option>			
		</select><BR />
	<LABEL for="trader">交易商編號: (0~49)</LABEL>
		<input type="text" name="traderNo" value="'.$traderNo.'">
		<BR />
        <LABEL for="specialist">專家名稱:</LABEL>
		<input type="text" name="specialist" value="'.$specialist.'">
		<BR />	
	<LABEL for="level1">實驗類型 1: </LABEL>
		<select name="level1">
			<option value="sp" '.$sp.'>專家之經營政策對交易代理人的影響評估</option>
			<option value="ac" '.$ac.'>交易代理人移動特徵分群</option>
			<option value="sc" '.$sc.'>專家代理人特徵分群</option>
			<option value="aa" '.$aa.'>自適應專家策略自主適應競爭態能力評估</option>
		</select><BR />
	<LABEL for="level2">實驗類型 2: </LABEL>
		<select name="level2">
			<option value="si" '.$si.'>單一市場</option>
			<option value="ho" '.$ho.'>同質市場</option>
			<option value="he" '.$he.'>異構市場</option>
			<option value="com" '.$com.'>競賽模式</option>
			<option value="real" '.$real.'>現實模式</option>
			<option value="GAME2008" '.$GAME2008.'>2008年競賽</option>
		</select><BR />
	<LABEL for="game">場次: (0001~9999)</LABEL>
			<input type="text" name="game" value="'.$game.'">
	<BR />
	<LABEL for="game">開始: (0000~)</LABEL>
			<input type="text" name="start" value="'.$start.'">
	<BR />
	<LABEL for="game">筆數: (20~)</LABEL>
			<input type="text" name="items" value="'.$items.'">
	<BR />
	<LABEL for="status">交易狀態: </LABEL>
		<select name="status">			
			<option value="placed" '.$placed.'>成功</option>
			<option value="pending" '.$pending.'>未決</option>
			<option value="both" '.$both.'>兩者</option>
		</select><BR />
    <INPUT type="submit" value="查詢"> <INPUT type="reset">
    </P>
 </FORM>
</td></tr></table>
</body>
</html>';

?>
